//
//  LoginViewController.m
//  电子书阅览器
//
//  Created by apple on 16/12/11.
//  Copyright © 2016年 LWB. All rights reserved.
//

#import "LoginViewController.h"
#import "MinInterfaceViewController.h"
#import "LWBNavigationViewController.h"
#import "LWBTabBarViewController.h"
@interface LoginViewController ()

@end

@implementation LoginViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
    //创建标签
    self.navigationItem.title =@"追风影视";
    UILabel *titleLabel = [[UILabel alloc]initWithFrame:CGRectMake(75, 79, 236, 45)];
    titleLabel.font =[UIFont systemFontOfSize:23];
    titleLabel.text = @"欢迎使用追风影视";
    titleLabel.textAlignment = NSTextAlignmentCenter;
    [self.view addSubview:titleLabel];
    
    //创建帐号标签
    UILabel *countLabel = [[UILabel alloc]initWithFrame:CGRectMake(56, 157, 51, 29)];
    countLabel.text = @"帐号:";
    countLabel.font =[UIFont systemFontOfSize:17];
    [self.view addSubview:countLabel];
    //创建帐号文本框
    UITextField *countText = [[UITextField alloc]initWithFrame:CGRectMake(111,155, 165,30)];
    countText.placeholder =@"请输入帐号";
    countText.borderStyle =  UITextBorderStyleRoundedRect;
    [self.view addSubview:countText];
    //创建密码标签
    UILabel *pwdLabel = [[UILabel alloc]initWithFrame:CGRectMake(53,217,56, 21)];
    pwdLabel.text = @"密码:";
    pwdLabel.font =[UIFont systemFontOfSize:17];
    [self.view addSubview:pwdLabel];
    //创建密码文本框
    UITextField *pwdText = [[UITextField alloc]initWithFrame:CGRectMake(111,213,165,30)];
    pwdText.placeholder =@"请输入密码";
    pwdText.borderStyle =  UITextBorderStyleRoundedRect;
    pwdText.secureTextEntry = YES;
    [self.view addSubview:pwdText];
    //创建记住密码
    UILabel *keepLabel = [[UILabel alloc]initWithFrame:CGRectMake(29,293,85,21)];
    keepLabel.text = @"记住密码:";
    keepLabel.font =[UIFont systemFontOfSize:17];
    [self.view addSubview:keepLabel];
    //创建记住密码switch
    UISwitch * keepSwitch =[[UISwitch alloc]initWithFrame:CGRectMake(131, 283, 51, 31)];
    [self.view addSubview:keepSwitch];
    //游客
    UIButton *tourists = [[UIButton alloc]initWithFrame:CGRectMake(102, 553, 183, 30)];
    tourists.titleLabel.font=[UIFont systemFontOfSize:17];
    [tourists setTitle:@"游客登录" forState:UIControlStateNormal];
    [tourists setTitleColor:[UIColor blueColor] forState:UIControlStateHighlighted];
    tourists.backgroundColor = [UIColor redColor];
    [self.view addSubview:tourists];
    //注册按钮
    UIButton *registered = [[UIButton alloc]initWithFrame:CGRectMake(66, 422, 50, 30)];
    registered.titleLabel.font =[UIFont systemFontOfSize:17];
    [registered setTitle:@"注册" forState:UIControlStateNormal];
     [registered setTitleColor:[UIColor blueColor] forState:UIControlStateHighlighted];
    registered.backgroundColor = [UIColor redColor];
    registered.layer.cornerRadius = 15;
    [self.view addSubview:registered];
    //忘记密码
    UIButton *forgetpwd = [[UIButton alloc]initWithFrame:CGRectMake(240, 427, 77, 30)];
    forgetpwd.titleLabel.font =[UIFont systemFontOfSize:17];
    [forgetpwd setTitle:@"忘记密码" forState:UIControlStateNormal];
    [forgetpwd setTitleColor:[UIColor blueColor] forState:UIControlStateHighlighted];
    forgetpwd.backgroundColor = [UIColor redColor];
    forgetpwd.layer.cornerRadius = 15;
    [self.view addSubview:forgetpwd];
    //登录按钮
    UIButton *login = [[UIButton alloc]initWithFrame:CGRectMake(164 ,367 ,46  ,30)];
    login.titleLabel.font =[UIFont systemFontOfSize:17];
    [login setTitle:@"登录" forState:UIControlStateNormal];
    [login setTitleColor:[UIColor blueColor] forState:UIControlStateHighlighted];
    login.backgroundColor = [UIColor redColor];
    login.layer.cornerRadius = 15;
    [login addTarget:self action:@selector(loginAction) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:login];
    // Do any apditional setup after loading the view.
}
-(void)loginAction{
   // MinInterfaceViewController *min = [[MinInterfaceViewController alloc]init];
    LWBTabBarViewController *tab = [[LWBTabBarViewController alloc]init];
    LWBNavigationViewController *nav = [[LWBNavigationViewController alloc]initWithRootViewController:tab];

    //创建动画
    CATransition *animation = [CATransition animation];
    //设置运动轨迹的速度
    animation.timingFunction = UIViewAnimationCurveEaseInOut;
    //设置动画类型为立方体动画
    animation.type = @"push";
    //设置动画时长
    animation.duration =0.5f;
    //设置运动的方向
    animation.subtype =kCATransitionFromRight;
    //控制器间跳转动画
    [[UIApplication sharedApplication].keyWindow.layer addAnimation:animation forKey:nil];
    [self presentViewController:nav animated:NO completion:nil];
    tab.navigationItem.title =@"追书";
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
